var ContactDefaultMask = {
	MASK_date : '99/99/9999',
	MASK_Phone : '(999) 999-9999',

	MaskDatePhoneInput : function () {
		var PageAttributes = Xrm.Page.data.entity.attributes.get();
		var fieldName = '';
		var Format = '';
		for (var i in PageAttributes) {
			var control = PageAttributes[i].controls.get(0);
			fieldName = PageAttributes[i].getName();
			Format = PageAttributes[i].getFormat();
			if (Format == 'phone' || Format == 'date') {
				control.setFocus();
				if (PageAttributes[i].getAttributeType() == 'datetime') {
					var input = $("#" + fieldName + "_i").find("input");
					if (input != null)
						input.mask(ContactDefaultMask.MASK_date);
				} else 
					$("#" + fieldName + "_i").mask(ContactDefaultMask.MASK_Phone);				
			}
		}
	},
}
